package com.sky.web.app;

import com.sky.constant.StatusConstant;
import com.sky.dto.DishPageDTO;
import com.sky.result.Result;
import com.sky.service.DishService;
import com.sky.vo.DishVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/dish")
public class AppDishController {
    @Autowired
    private DishService dishService;
    @GetMapping("list")
    public Result findListByCategory4App(Long categoryId){
        DishPageDTO dishPageDTO = DishPageDTO.builder()
                .categoryId(categoryId)
                .status(StatusConstant.ENABLE)
                .build();
       List<DishVO> list = dishService.findListByCategory4App(dishPageDTO);
        return Result.success(list);
    }
}
